package com.longxi.tianjintianbao.ui.activity.rectification;

import android.content.Intent;
import android.widget.Button;
import android.widget.EditText;
import android.widget.RadioGroup;

import com.longxi.tianjintianbao.R;
import com.longxi.tianjintianbao.ui.base.BaseActivity;
import com.longxi.tianjintianbao.ui.presenter.rectification.RectificationAtPresenter;
import com.longxi.tianjintianbao.ui.view.rectification.IRectificationAtView;

import butterknife.BindView;

public class RectificationActivity extends BaseActivity<IRectificationAtView, RectificationAtPresenter> implements IRectificationAtView {
    @BindView(R.id.etMeasures)
    EditText mEtMeasures;
    @BindView(R.id.etReason)
    EditText mEtReason;
    @BindView(R.id.etContents)
    EditText mEtContents;
    @BindView(R.id.radioGroup)
    RadioGroup mRadioGroup;
    @BindView(R.id.btnLogin)
    Button mBtnLogin;

    @Override
    protected int provideContentViewId() {
        return R.layout.activity_rectification;
    }

    @Override
    public void initData() {
        super.initData();
        mPresenter.setBar();
    }

    @Override
    public void initListener() {
        super.initListener();
        mBtnLogin.setOnClickListener(v -> mPresenter.saveRectification());
        mRadioGroup.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(RadioGroup group, int checkedId) {
                if(checkedId == R.id.rBtnYes){
                    mPresenter.remark = "已完成";
                }else{
                    mPresenter.remark = "未完成";
                }
            }
        });
    }

    @Override
    protected RectificationAtPresenter createPresenter() {
        return new RectificationAtPresenter(this);
    }

    @Override
    public EditText getEtMeasures() {
        return mEtMeasures;
    }

    @Override
    public EditText getEtReason() {
        return mEtReason;
    }

    @Override
    public EditText getEtContents() {
        return mEtContents;
    }

    @Override
    public RadioGroup getRadioGroup() {
        return mRadioGroup;
    }

    @Override
    public Button getBtnLogin() {
        return mBtnLogin;
    }

    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
    }

}


